//配置管理
const {
  resolve
} = require('path');

//默认端口: 为当前进程环境下的端口
const port = process.env.npm_config_port | '3000';

//默认域名
const domain = 'http://localhost';
const title = 'This is my first Document by Vite-Doc-Creator';

//工作区路径管理
//项目目录体系: 外部路径
//src目录：src > css | js | html(md -> html)
//work目录: workspace(编辑md文件)  
const outerPath = {
  //项目根路径 __dirname当前文件夹下 config -> vite-doc-creator -> dev
  rootPath: resolve(__dirname, '../../../'),
  //src文件夹
  srcPath: resolve(__dirname, '../../../src/'),
  //src > html文件夹
  htmlPath: resolve(__dirname, '../../../src/html/'),
  //src > css文件夹
  cssPath: resolve(__dirname, '../../../src/css/'),
  //src > js文件夹
  jsPath: resolve(__dirname, '../../../src/js/'),
  //workspace文件夹
  mdPath: resolve(__dirname, '../../../workspace/')
}

//插件目录体系: 内部路径(dev)
//temp_files > css | js | html(index.html/md.html/welcome模板)
const innerDirPath = {
  //开发主目录
  rootDir: resolve(__dirname, '../temp_files/'),
  //temp_files > html目录
  htmlDir: resolve(__dirname, '../temp_files/html/'),
  //temp_files > css目录
  cssDir: resolve(__dirname, '../temp_files/css/'),
  //temp_files > js目录
  jsDir: resolve(__dirname, '../temp_files/js/'),
}

//正则
const regexp = {
  //匹配: 标题内容
  reg_titleContent: /<title>([\s\S]*?)<\/title>/,
  //匹配: <h1 class="header-title"></h1>内的子节点或文本内容
  reg_headerTitleContent: /\<h1 class=\"header-title\">([\s\S]*?)\<\/h1\>/,
  //匹配: <ul class="menu-list"></ul>内的子节点或文本内容
  //[]区间 \s回车\换行\制表\垂直\换页 \S 非回车\换行\制表\垂直\换页
  reg_ulContent: /\<ul class=\"menu-list\"\>([\s\S]*?)<\/ul\>/,
  //匹配：<div class="iframe-page"></div>内的子节点或文本内容
  reg_iframeContent: /<div class=\"iframe-page\">([\s\S]*?)<\/div>/,
  //匹配：md.html内部的{{newStr}}
  reg_mdStr: /\{\{(.+?)\}\}/
}

module.exports = {
  port,
  domain,
  title,
  outerPath,
  innerDirPath,
  regexp
}